'use strict';

const { request } = require("http");
const api = "https://api.weixin.qq.com/sns/jscode2session"
const db = uniCloud.database()
exports.main = async (event, context) => {
	let res = await uniCloud.httpclient.request(api,{
		method:'GET',
		dataAsQueryString:false,
		dataType:'json',
		data:{
			appid:"wx579d0a940386f1f4",
			secret:"0c067603f17815a846bda188daa0b324",
			js_code:event.code,
			rant_type:"authorization_code"
		}
	})
	//返回数据给客户端
	return res
};